class Yytoken{

	public int id;
	
	public String lexema;
	
	public int linea;

	Yytoken(int id, String lexema, int linea){
		this.id = id;
		this.lexema = lexema;
		this.linea = linea;
	}
	
	public String toString(){
		return "Token " + id + "(" + linea + "):\t" + lexema;
	}
}

%%

%line
ALPHA=[A-Za-z]
DIGIT=[0-9]
ALPHA_NUMERIC={ALPHA}|{DIGIT}
IDENTIFICADOR={ALPHA}({ALPHA_NUMERIC})*
NUMERO=({DIGIT})*
WHITE_SPACE=[\f\ \t\b\r\n]


%%
{NUMERO} { return (new Yytoken(0,yytext(),yyline)); }
{WHITE_SPACE} { return (new Yytoken(1,yytext(),yyline)); }
{IDENTIFICADOR} { return (new Yytoken(2,yytext(),yyline)); }
"(" { return (new Yytoken(3,yytext(),yyline)); }
")" { return new Yytoken(4, yytext(), yyline); }
"+" { return new Yytoken(5, yytext(), yyline); }
"*" { return new Yytoken(6, yytext(), yyline); }
. {System.out.println("Error: caracter desconocido" + yytext()); }